﻿using System.Diagnostics;

namespace System
{
  [DebuggerStepThrough]
  public static class EnumExtensions
  {
    public static T ToEnum<T>(this string str) where T : struct
    {
      return (T) Enum.Parse(typeof (T), str);
    }

    public static T ToEnum<T>(this string str, bool ignoreCase) where T : struct
    {
      return (T) Enum.Parse(typeof (T), str, ignoreCase);
    }
  }
}